Skip to content

Conversation

@Doy-lee
Copy link

@Doy-lee Doy-lee commented Aug 27, 2025

This PR goes ontop of #63 only need to review the delta between the two.

--

The commits here are a polish pass over the draft code that was dumped into src/pro.cpp. That file has been renamed to src/pro_backend.cpp. The role of this file now is to interop with the pro backend and adds a bunch of functions to construct the necessary HTTP POST payloads to send off to a Session Pro Backend to do one of the following operations:

  1. Redeem a payment the client has purchased for entitlement to Session Pro. This gets the Session Pro Backend after verifying it successfully, to generate a proof that the client can attach to their messages to enable Pro features.
  2. Authorise a new Ed25519 key pair to be the signatory of their Session Pro Proof that can be used on the protocol
  3. Retrieve the historical list of payments associated with a Session account
  4. Get the current list of global proofs which is maintained by the Session Pro backend that clients will reject proofs from until the designated expiry time.

Additionally for each payment provider, libsession exposes the various platform specific URLs to centralise those strings into the same repository, as per:

const session_pro_payment_provider_metadata SESSION_PRO_PAYMENT_PROVIDER_METADATA[SESSION_PRO_PAYMENT_PROVIDER_COUNT] = {
    /*SESSION_PRO_PAYMENT_PROVIDER_NIL*/ {
        .request_refund_support_url = string8_literal(""),
        .subscription_page_url      = string8_literal(""),
    },
    /*SESSION_PRO_PAYMENT_PROVIDER_GOOGLE_PLAY_STORE*/ {
        .request_refund_support_url = string8_literal("https://support.google.com/googleplay/workflow/9813244"),
        .subscription_page_url      = string8_literal("https://play.google.com/store/account/subscriptions?package=network.loki.messenger"),
    },
    /*SESSION_PRO_PAYMENT_PROVIDER_IOS_APP_STORE*/ {
        .request_refund_support_url = string8_literal("https://support.apple.com/118223"),
        .subscription_page_url      = string8_literal("https://account.apple.com/account/manage/section/subscriptions")
    }
};

The general usage pattern for the request and response code available in pro_backend.{hpp,h}

GetProProofRequest  request       = {...};                                           // Build the request object
std::string         request_json  = request.to_json();                               // Convert it to json
std::string         response_json = send_net_request(pro_backend_url, request_json); // Send POST request using your networking APIs
GetProProofResponse response      = GetProProofResponse::parse(response_json);

if (response.status == SESSION_PRO_BACKEND_SUCCESS_STATUS) {
  // Success! Use the values in the struct
} else {
  // Failure! Parsing errors or input validation errors. Errors are held in the errors array
  for (auto it : response.errors)
    fprintf(stderr, "ERROR: %s\n", it.c_str());
}

@Doy-lee Doy-lee force-pushed the doyle-pro-backend-polish branch 4 times, most recently from 410f0e7 to a83ab26 Compare August 29, 2025 05:50
@Doy-lee Doy-lee force-pushed the doyle-pro-backend-polish branch 4 times, most recently from 745e4ca to 7bf64c8 Compare September 25, 2025 04:11
@Doy-lee Doy-lee force-pushed the doyle-pro-backend-polish branch 3 times, most recently from f8c8263 to 6af3762 Compare October 22, 2025 01:23
@Doy-lee Doy-lee force-pushed the doyle-pro-backend-polish branch from 7cb1ea3 to 8136920 Compare October 23, 2025 05:21
SessionHero01 and others added 30 commits November 19, 2025 17:29
Added syncing for Session Pro profile values
…y-ts

Added syncing for a 'pro_access_expiry_ts' value
Separation of concerns and makes diffing changes in bitsets at the
protoco level more ergonomic (because config diff works at the data-type
primitive level not bit level, e.g. you can diff sets easily rather than
indiviual bits in a byte).
Co-authored-by: Audric Ackermann <audric.bilb@gmail.com>
Split the bitset into separate profile/message bitsets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants